import json


class CommonTool:
    @classmethod
    def assert_succeed(cls, self, res, status_code, status, msg):
        self.assertEqual(status_code, res.status_code)
        self.assertEqual(status, res.json().get("status"))
        self.assertEqual(msg, res.json().get("msg"))

    @classmethod
    def lest_data(cls):
        with open("../data/loging_data.json", "r", encoding="utf-8") as j:  # 打开test1.json文件
            lis2 = json.load(j)  # 把文件数据传给lis2
        unm = []
        for i in lis2:  # 用循环读取lis2数据
            unm.append(tuple(i.values()))  # 用循环吧一个一个元祖放到列表里
        return unm  # 输出一个元祖列表
